
package nccloud.web.hrppl.jxaims.jxaimsvo.action;

import nc.itf.org.IOrgResourceCodeConst;
import nccloud.framework.web.processor.refgrid.RefQueryInfo;
import nccloud.framework.web.processor.reftree.TreeRefQueryInfo;
import nccloud.framework.web.ui.meta.RefMeta;
import nccloud.web.refer.DefaultGridRefAction;
import nccloud.commons.lang.StringUtils;

/**
 * 
 * 档案特性生成默认参照
 * 
 * @author zhaoxwf
 * 
 */
public class JXaimsVOGridRefAction extends DefaultGridRefAction {
	
	public JXaimsVOGridRefAction() {
		super();
		setResourceCode(IOrgResourceCodeConst.ORG);
	}

	@Override
	public RefMeta getRefMeta(RefQueryInfo refQueryInfo) {
		RefMeta refMeta = new RefMeta();		
		setResourceCode(IOrgResourceCodeConst.ORG);
		refMeta.setCodeField("code");
		refMeta.setNameField("name");
		refMeta.setPkField("pk_jxaims");
		refMeta.setTableName("hrppl_jxaims");
		refMeta.setMutilLangNameRef(true);
		return refMeta;
	}
	
	@Override
  	public String getExtraSql(RefQueryInfo refQueryInfo, RefMeta refMeta) {
  		if(refQueryInfo instanceof TreeRefQueryInfo) {
  			String pid = ((TreeRefQueryInfo) refQueryInfo).getPid();
  			if (StringUtils.isNotEmpty(pid)) {
  				return " and pk_jxaimstype = '" + pid + "'";
  			}
  		}
  		return super.getExtraSql(refQueryInfo, refMeta);
  	}

}
